package com.kaishengit.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.kaishengit.pojo.Document;
import com.kaishengit.pojo.Project;

@Repository
public class DocumentDao extends BaseDao<Document, String>{

	public List<Document> documentList(){
		String hql = "from Document";
		Query query = getSession().createQuery(hql);
		@SuppressWarnings("unchecked")
		List<Document> documentList=query.list();
		
		return documentList;
	}
	
	public void update(Document document){
		
		getSession().update(document);
		
	}

	public List<Document> findAllByPro(Project project) {
		String hql = "from Document where projectid = :id order by createtime desc";
		Query query = getSession().createQuery(hql);
		query.setParameter("id", project);
		
		@SuppressWarnings("unchecked")
		List<Document> documentList = query.list();
		return documentList;
	}



	
}
